package com.yihaodian.cluster.discovery.zk;

import org.apache.log4j.Logger;

public class ZkPath{
	private static final Logger logger = Logger.getLogger(ZkPath.class);

	private final String rootPath;

	private final String clustersPath;

	private final String clusterPath;

	private final String masterPath;

	private final String nodePath;

	private final String statePath;
	
	private final String lockPath;

	public ZkPath(String rootPath, String clusterName) {
		this.rootPath = rootPath;
		// clusters
		clustersPath = rootPath + "/" + "clusters";

		// cluster
		clusterPath = clustersPath + "/" + clusterName;

		// node, master, meta
		nodePath = clusterPath + "/" + "nodes";
		masterPath = clusterPath + "/" + "master";
		statePath = clusterPath + "/" + "state";
		lockPath = clusterPath + "/" + "lock";

		logger.info("zk clusterPath: " + clusterPath);
	}
	
	public String getRootPath() {
		return rootPath;
	}

	public String getClustersPath() {
		return clustersPath;
	}

	public String getClusterPath() {
		return clusterPath;
	}

	public String getMasterPath() {
		return masterPath;
	}

	public String getNodePath() {
		return nodePath;
	}

	public String getStatePath() {
		return statePath;
	}

	public String getLockPath() {
		return lockPath;
	}
}
